package com.itheima.c03_api_array_sort;

import java.util.Arrays;

public class LambdaTest2 {
    public static void main(String[] args) {
        Student[] students = {
                new Student("张三", 180, 20),
                new Student("李四", 180, 18),
                new Student("王五", 180, 19)};

      //  Arrays.sort(students);


        System.out.println(Arrays.toString(students));

 /*       Arrays.sort(students, new Comparator<Student>() {
            @Override
            public int compare(Student o1, Student o2) {
                return o1.getAge() - o2.getAge();
            }
        });*/
      //  Arrays.sort(students, (o1, o2) -> o1.getAge()-o2.getAge());

        Arrays.sort(students,(Student o1,Student o2)->/*{*/
            /*return */o1.getAge() - o2.getAge()/*;*/
        /*}*/);
        for (int i = 0; i < students.length; i++) {
            System.out.println(students[i]);
        }
    }
}
